home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / database / winsql20.zip / SQL.DOC < prev    next >
Text File  |  1991-10-26  |  122KB  |  3,163 lines

  1.  
  2.           Orion SQL API                                     Page 1 of 51
  3.  
  4.  
  5.                               Orion SQL For Windows
  6.  
  7.                            Release 2.0 - November 1991
  8.  
  9.  
  10.                 ORION SQL APPLICATIONS PROGRAMMING INTERFACE (API)
  11.  
  12.  
  13.                      Copyright (c) 1991 by Stellar Industries
  14.                                All Rights Reserved
  15.  
  16.  
  17.                                      Summary
  18.  
  19.  
  20.           This manual is divided into six sections:
  21.  
  22.           Overview       This section describes, in general terms, what
  23.                          the Orion SQL API is and how you might use it
  24.                          to execute SQL statements within your program.
  25.                          Examples are available both in 'C' (EXAMPLEC.*)
  26.                          and 'Visual Basic' (EXAMPLEB.*).
  27.  
  28.           Functions      This section includes a formal description of
  29.                          all functions which your program can import
  30.                          from the Orion SQL API dynamic link library
  31.                          (SQL.LIB, SQL.DLL).  Prototypes for all
  32.                          functions can be found in the Orion SQL API
  33.                          include file for 'C' (SQL.H) and the global
  34.                          file for 'Visual Basic' (SQL.GBL).
  35.  
  36.           Constants      This section includes a formal description of
  37.                          all constants defined in the Orion SQL API
  38.                          include file for 'C' and the global file for
  39.                          'Visual Basic'.
  40.  
  41.           Data Structures This section includes a formal description of
  42.                          all data structures which your program will use
  43.                          when it communicates with the Orion SQL API.
  44.                          Typedefs for all these structures can be found
  45.                          in the Orion SQL API include file for 'C'.
  46.                          Declarations can be found in the global file
  47.                          for 'Visual Basic'.
  48.  
  49.           Result Codes   This section gives an explanation of all result
  50.                          codes returned by the Orion SQL API.  Macro
  51.                          definitions for all result codes can be found
  52.                          in the Orion SQL API include file for 'C'.
  53.                          Global Const definitions can be found in the
  54.                          global file for 'Visual Basic'.
  55.  
  56.           Glossary       This section defines specialized terms used in
  57.                          this document.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                  Summary
  64.           Orion SQL API                                     Page 2 of 51
  65.  
  66.  
  67.                                      Overview
  68.  
  69.  
  70.           What is the Orion SQL API?
  71.  
  72.                     The Orion SQL API is a powerful tool that enables
  73.                     you, the software developer, to have full access to
  74.                     a modern, highly optimized ANSI standard SQL
  75.                     database manager: the Orion Database Administrator.
  76.                     Your programs written in any language which can
  77.                     access dynamic link libraries can also access the
  78.                     Orion SQL API.  These languages include 'C', 'C++',
  79.                     'Visual Basic', 'Pascal' and most assemblers.  In
  80.                     fact, any program which can access the Microsoft
  81.                     Windows environment can access the Orion SQL API.
  82.                     Microsoft Windows itself is a dynamic link library.
  83.  
  84.                     The Orion SQL API is your gateway to modern database
  85.                     technology.  With a little more than a dozen
  86.                     functions and only 4 data structures you can perform
  87.                     almost any database task.
  88.  
  89.           How does the Orion SQL API work?
  90.  
  91.                     "How is this done?" you might ask.  Well, while the
  92.                     Orion Database Administrator is sophisticated,
  93.                     complex and fully optimized for maximum performance:
  94.                     the Orion SQL API is simple and straight forward.
  95.                     The Orion SQL API effectively buffers you from all
  96.                     the complex tasks of parsing, query analysis, query
  97.                     optimization, query tree construction, etc.
  98.  
  99.           How do I link to the Orion SQL API?
  100.  
  101.                     When programming in 'C', you need to do only three
  102.                     things to include all the power of SQL in your
  103.                     application:
  104.  
  105.                     1)   When you link your object modules, include the
  106.                          SQL.LIB import library along with LIBW.LIB.
  107.  
  108.                     2)   Include the SQL.H file (e.g.  "#include
  109.                          <SQL.H>") in your source code.
  110.  
  111.                     3)   Put the Orion Database Administrator (DBA.EXE)
  112.                          and Orion SQL API (SQL.DLL) someplace where
  113.                          windows can find them (usually in your windows
  114.                          directory).
  115.  
  116.                     When programming in 'Visual Basic', you need to do
  117.                     only two things to include all the power of SQL in
  118.                     your application:
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.                                                                 Overview
  126.           Orion SQL API                                     Page 3 of 51
  127.  
  128.  
  129.                     1)   Be sure to use the SQL.GBL file included with
  130.                          the Orion SQL API.  Note that the 'C' style
  131.                          prefixes used with variable names (i.e.  the
  132.                          'n' in nResultCode, and the 'sz' in
  133.                          szErrorMessage) are not used with 'Visual
  134.                          Basic'.
  135.  
  136.                     2)   Put the Orion Database Administrator (DBA.EXE)
  137.                          and Orion SQL API (SQL.DLL) someplace where
  138.                          windows can find them (usually in your windows
  139.                          directory).
  140.  
  141.           How do I use the Orion SQL API?
  142.  
  143.                     Your program can login to the Orion Database
  144.                     Administrator (SqlLogin), open a cursor
  145.                     (SqlCursorOpen) and execute a query (SqlExecute).
  146.                     The query itself is passed to the Orion SQL API as a
  147.                     simple text string.  The Orion SQL API does all the
  148.                     work for you.  To get your answers back (from a
  149.                     SELECT statement, for example) you simply fetch them
  150.                     one at a time from the Orion SQL API.  You can fetch
  151.                     the first record (SqlFetchFirst), last record
  152.                     (SqlFetchLast), next record (SqlFetchNext), previous
  153.                     record (SqlFetchPrevious) or even a record at a
  154.                     position you specify (SqlFetchPositioned).
  155.  
  156.                     You can have several cursors open at a time so that
  157.                     you can access your data the way you want.
  158.  
  159.                     When you're all done, close your cursors
  160.                     (SqlCursorClose) and log out (SqlLogout).
  161.  
  162.           How can I check out my SQL statements?
  163.  
  164.                     You can check out your SQL statements using the
  165.                     Orion Query Editor (QE.EXE) included with the Orion
  166.                     SQL API.  The Orion Query Editor allows you to type
  167.                     in the query your program is going to send to the
  168.                     Orion SQL API and have it execute right there in
  169.                     front of you.  You'll get all the results back on
  170.                     the screen where you can verify it's what you
  171.                     expected.  In fact, the Orion Query Editor uses the
  172.                     Orion SQL API the same way your program does.
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.                                                                 Overview
  188.           Orion SQL API                                     Page 4 of 51
  189.  
  190.  
  191.                                     Functions
  192.  
  193.  
  194.           All Orion SQL API functions utilize a common structure to
  195.           maintain generic information : SQLCONTROL.  All functions load
  196.           descriptive error information into this structure should an
  197.           error condition arise.  The basic status condition is the
  198.           nResultCode field of this data structure.  All Orion SQL API
  199.           functions set this field to the appropriate result code in the
  200.           event of an error.  Note: All Orion SQL API functions clear
  201.           this field to 0 at entry.
  202.  
  203.           SqlCursorClose      Closes a cursor when it is no longer
  204.                               needed
  205.  
  206.           SqlCursorOpen       Opens a cursor in preparation for
  207.                               executing a query
  208.  
  209.           SqlDescribeColumn   Describes an individual column in the
  210.                               result table
  211.  
  212.           SqlDescribeTable    Describes the overall characteristics of
  213.                               the result table
  214.  
  215.           SqlExecute          Causes the database administrator to
  216.                               execute a query and potentially create a
  217.                               result table
  218.  
  219.           SqlFetchFirst       Retrieves the first record from the result
  220.                               table
  221.  
  222.           SqlFetchLast        Retrieves the last record from the result
  223.                               table
  224.  
  225.           SqlFetchNext        Retrieves the next record from the table
  226.  
  227.           SqlFetchPrevious    Retrieves the previous record from the
  228.                               result table
  229.  
  230.           SqlFetchPositioned  Retrieves a particular record from the
  231.                               result table.  The record is identified by
  232.                               its absolute physical position in the
  233.                               table
  234.  
  235.           SqlGetStatus        Gets status information concerning the
  236.                               last query executed
  237.  
  238.           SqlLogin            Logs an user onto the database
  239.                               administrator
  240.  
  241.           SqlLogout           Logs an user off the database
  242.                               administrator
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.                                                                Functions
  250.           Orion SQL API                                     Page 5 of 51
  251.  
  252.  
  253.                             Functions: SqlCursorClose
  254.  
  255.  
  256.           Syntax         BOOL FAR PASCAL SqlCursorClose(hUser, hCursor,
  257.                               lpSqlControl)
  258.  
  259.                          This function closes the cursor specified by
  260.                          the hCursor parameter and drops any result
  261.                          table associated with it.
  262.  
  263.                          Parameter      Type/Description
  264.  
  265.                          hUser          HANDLE Identifies the user who
  266.                                         owns the cursor.  The hUser
  267.                                         parameter must have been created
  268.                                         with the SqlLogin function.
  269.  
  270.                          hCursor        HANDLE Identifies the cursor to
  271.                                         be closed.  The hCursor
  272.                                         parameter must have been created
  273.                                         with the SqlCursorOpen function.
  274.  
  275.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  276.                                         control structure.  Any errors
  277.                                         that may occur cause the
  278.                                         szErrorDetail, szErrorMessage
  279.                                         and nResultCode fields of this
  280.                                         structure to be loaded with
  281.                                         descriptive information.
  282.  
  283.           Return Value   The return value is 1 if no errors occurred
  284.                          while closing the cursor, otherwise it is 0.
  285.  
  286.           Comments       Cursors should be closed before logging off
  287.                          with SqlLogout.
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.                                                Functions: SqlCursorClose
  312.           Orion SQL API                                     Page 6 of 51
  313.  
  314.  
  315.                              Functions: SqlCursorOpen
  316.  
  317.  
  318.           Syntax         HANDLE FAR PASCAL SqlCursorOpen(hUser,
  319.                               lpSqlControl)
  320.  
  321.                          This function creates a cursor.  You must
  322.                          create a cursor after you have logged in
  323.                          (SqlLogin) and before you execute a query
  324.                          (SqlExecute).  You can create as many cursors
  325.                          as you need for your application.
  326.  
  327.                          Parameter      Type/Description
  328.  
  329.                          hUser          HANDLE Identifies the user who
  330.                                         will own the cursor.  The hUser
  331.                                         parameter must have been created
  332.                                         with the SqlLogin function.
  333.  
  334.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  335.                                         Control Structure.  Any errors
  336.                                         that may occur cause the
  337.                                         szErrorDetail, szErrorMessage
  338.                                         and nResultCode fields of this
  339.                                         structure to be loaded with
  340.                                         descriptive information.
  341.  
  342.           Return Value   The return value is a cursor handle if no
  343.                          errors occurred while opening the cursor,
  344.                          otherwise it is 0.
  345.  
  346.           Comments       The cursors created by one user are not
  347.                          available to another.  Once a cursor has been
  348.                          created and used in an SqlExecute, it may be
  349.                          reused in another SqlExecute by the same user.
  350.                          When a cursor is reused in this manner, the
  351.                          Orion SQL API effectively closes the cursor and
  352.                          re-opens it with the same handle prior to
  353.                          executing the next query.  Note that when a
  354.                          cursor is reused, any old result table
  355.                          associated with it is dropped.  Cursors are
  356.                          closed with SqlCursorClose.  Cursors should be
  357.                          closed before logging off with SqlLogout.
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.                                                 Functions: SqlCursorOpen
  374.           Orion SQL API                                     Page 7 of 51
  375.  
  376.  
  377.                            Functions: SqlDescribeColumn
  378.  
  379.  
  380.           Syntax         BOOL FAR PASCAL SqlDescribeColumn(hUser,
  381.                               hCursor, lpSqlControl,
  382.                               nColumnSequenceNumber, lpSqlColumn)
  383.  
  384.                          This function describes the characteristics of
  385.                          the specified column (nColumnSequenceNumber) in
  386.                          the result table associated with the hCursor
  387.                          parameter.  The description is loaded into the
  388.                          SQLCOLUMN structure pointed to by the
  389.                          lpSqlColumn parameter.  To describe a column
  390.                          you must have already logged in (SqlLogin),
  391.                          created a cursor (SqlCursorOpen) and executed a
  392.                          query (SqlExecute) which contained an SQL
  393.                          SELECT statement.
  394.  
  395.                          Parameter      Type/Description
  396.  
  397.                          hUser          HANDLE Identifies the user who
  398.                                         owns the cursor.  The hUser
  399.                                         parameter must have been created
  400.                                         with the SqlLogin function.
  401.  
  402.                          hCursor        HANDLE Identifies the cursor
  403.                                         which owns the result table in
  404.                                         which the column exists.  The
  405.                                         hCursor parameter must have been
  406.                                         created with the SqlCursorOpen
  407.                                         function.  A result table must
  408.                                         be associated with the cursor.
  409.                                         A result table is created when a
  410.                                         query containing an SQL SELECT
  411.                                         statement is passed to
  412.                                         SqlExecute.
  413.  
  414.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  415.                                         Control Structure.  Any errors
  416.                                         that may occur cause the
  417.                                         szErrorDetail, szErrorMessage
  418.                                         and nResultCode fields of this
  419.                                         structure to be loaded with
  420.                                         descriptive information.
  421.  
  422.                          nColumnSequenceNumber    unsigned Identifies
  423.                                         the column to be described.
  424.                                         Column numbers range from 1 to
  425.                                         the number of columns in the
  426.                                         result table.
  427.  
  428.                          lpSqlColumn    LPSQLCOLUMN Points to the target
  429.                                         SQL Column Description
  430.                                         Structure.
  431.  
  432.  
  433.  
  434.  
  435.                                             Functions: SqlDescribeColumn
  436.           Orion SQL API                                     Page 8 of 51
  437.  
  438.  
  439.           Return Value   The return value is 1 if no errors occurred,
  440.                          otherwise it is 0.
  441.  
  442.           Comments       If a result table is not associated with the
  443.                          cursor an error will be generated.
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.                                             Functions: SqlDescribeColumn
  498.           Orion SQL API                                     Page 9 of 51
  499.  
  500.  
  501.                            Functions: SqlDescribeTable
  502.  
  503.  
  504.           Syntax         BOOL FAR PASCAL SqlDescribeTable(hUser,
  505.                               hCursor, lpSqlControl, lpSqlTable)
  506.  
  507.                          This function describes the characteristics of
  508.                          the result table associated with the hCursor
  509.                          parameter.  The description is loaded into the
  510.                          SQLTABLE structure pointed to by the lpSqlTable
  511.                          parameter.  To describe a table you must have
  512.                          already logged in (SqlLogin), created a cursor
  513.                          (SqlCursorOpen) and executed a query
  514.                          (SqlExecute) which contained an SQL SELECT
  515.                          statement.
  516.  
  517.                          Parameter      Type/Description
  518.  
  519.                          hUser          HANDLE Identifies the user who
  520.                                         owns the cursor.  The hUser
  521.                                         parameter must have been created
  522.                                         with the SqlLogin function.
  523.  
  524.                          hCursor        HANDLE Identifies the cursor
  525.                                         which owns the result table.
  526.                                         The hCursor parameter must have
  527.                                         been created with the
  528.                                         SqlCursorOpen function.  A
  529.                                         result table must be associated
  530.                                         with the cursor.  A result table
  531.                                         is created when a query
  532.                                         containing an SQL SELECT
  533.                                         statement is passed to
  534.                                         SqlExecute.
  535.  
  536.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  537.                                         Control Structure.  Any errors
  538.                                         that may occur cause the
  539.                                         szErrorDetail, szErrorMessage
  540.                                         and nResultCode fields of this
  541.                                         structure to be loaded with
  542.                                         descriptive information.
  543.  
  544.                          lpSqlTable     LPSQLTABLE Points to the target
  545.                                         SQL Table Description Structure.
  546.  
  547.           Return Value   The return value is 1 if no errors occurred,
  548.                          otherwise it is 0.
  549.  
  550.           Comments       If a result table is not associated with the
  551.                          cursor an error will be generated.
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.                                              Functions: SqlDescribeTable
  560.           Orion SQL API                                    Page 10 of 51
  561.  
  562.  
  563.                               Functions: SqlExecute
  564.  
  565.  
  566.           Syntax         BOOL FAR PASCAL SqlExecute(hUser, hCursor,
  567.                               lpSqlControl, lpstrQueryText)
  568.  
  569.                          This function executes the query text pointed
  570.                          to by the lpstrQueryText parameter as a set of
  571.                          one or more SQL statements.  If an SQL SELECT
  572.                          statement is included in the query text, a
  573.                          result table is created and associated with the
  574.                          hCursor parameter.  To execute a query you must
  575.                          have already logged in (SqlLogin) and created a
  576.                          cursor (SqlCursorOpen).
  577.  
  578.                          Parameter      Type/Description
  579.  
  580.                          hUser          HANDLE Identifies the user who
  581.                                         owns the cursor.  The hUser
  582.                                         parameter must have been created
  583.                                         with the SqlLogin function.
  584.  
  585.                          hCursor        HANDLE Identifies the cursor
  586.                                         which will own the result table
  587.                                         if one is created by the query.
  588.                                         The hCursor parameter must have
  589.                                         been created with the
  590.                                         SqlCursorOpen function.
  591.  
  592.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  593.                                         Control Structure.  Any errors
  594.                                         that may occur cause the
  595.                                         szErrorDetail, szErrorMessage
  596.                                         and nResultCode fields of this
  597.                                         structure to be loaded with
  598.                                         descriptive information.
  599.                                         Additionally, syntax errors
  600.                                         detected by the query manager
  601.                                         cause the nHiLiteOffset field to
  602.                                         be loaded with the character
  603.                                         position of the offending phrase
  604.                                         within the query text.  In this
  605.                                         case, the nHiLiteLength field is
  606.                                         loaded with the number of
  607.                                         characters in the offending
  608.                                         phrase.
  609.  
  610.                          lpstrQueryText LPSTR Points to a null
  611.                                         terminated string containing the
  612.                                         SQL query.  The SQL query may
  613.                                         contain one or more SQL
  614.                                         statements.  Among the SQL
  615.                                         statements there can be only 0
  616.                                         or 1 SQL SELECT statement.
  617.  
  618.  
  619.  
  620.  
  621.                                                    Functions: SqlExecute
  622.           Orion SQL API                                    Page 11 of 51
  623.  
  624.  
  625.           Return Value   The return value is 1 if no errors occurred,
  626.                          otherwise it is 0.
  627.  
  628.           Comments       Simply calling SqlExecute does not commit your
  629.                          query.  Queries are committed when you execute
  630.                          an SQL COMMIT WORK statement.  Be sure to
  631.                          execute this vital statement whenever you want
  632.                          your program to permanently modify the
  633.                          database.
  634.  
  635.                          Each user must close all cursors which have an
  636.                          associated result table before executing an SQL
  637.                          COMMIT WORK statement.  This is to insure that
  638.                          your application has completed its access to
  639.                          the result table before permanently committing
  640.                          the transaction.  A convenient way to do this
  641.                          is to use the same cursor for the COMMIT WORK
  642.                          as you did for the SELECT: the Orion SQL API
  643.                          automatically drops any result table that may
  644.                          be associated with a cursor when the cursor is
  645.                          reused.
  646.  
  647.                          Without the SQL COMMIT WORK statement, all your
  648.                          transactions will be rolled back when either an
  649.                          error occurs or when you log off (SqlLogout).
  650.                          The only exception to this is if you have the
  651.                          mSqlFlagAutoCommitOnLogout option flag set in
  652.                          the wFlags field of the lpSqlControl parameter
  653.                          when you log off.  Only in this case are all
  654.                          your transactions automatically committed at
  655.                          logout, and then only if no errors have
  656.                          occurred.
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.                                                    Functions: SqlExecute
  684.           Orion SQL API                                    Page 12 of 51
  685.  
  686.  
  687.                              Functions: SqlFetchFirst
  688.  
  689.  
  690.           Syntax         BOOL FAR PASCAL SqlFetchFirst(hUser, hCursor,
  691.                               lpSqlControl, lpRecordBuffer)
  692.  
  693.                          This function reads the first record in the
  694.                          result table associated with the hCursor
  695.                          parameter.  The data in this record is
  696.                          formatted and loaded into the buffer pointed to
  697.                          by the lpRecordBuffer parameter.  To fetch this
  698.                          record you must have already logged in
  699.                          (SqlLogin), created a cursor (SqlCursorOpen)
  700.                          and executed a query (SqlExecute) which
  701.                          contained an SQL SELECT statement.
  702.  
  703.                          Parameter      Type/Description
  704.  
  705.                          hUser          HANDLE Identifies the user who
  706.                                         owns the cursor.  The hUser
  707.                                         parameter must have been created
  708.                                         with the SqlLogin function.
  709.  
  710.                          hCursor        HANDLE Identifies the cursor
  711.                                         which owns the result table in
  712.                                         which the record exists.  The
  713.                                         hCursor parameter must have been
  714.                                         created with the SqlCursorOpen
  715.                                         function.  A result table must
  716.                                         be associated with the cursor.
  717.                                         A result table is created when a
  718.                                         query containing an SQL SELECT
  719.                                         statement is passed to
  720.                                         SqlExecute.
  721.  
  722.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  723.                                         Control Structure.  Any errors
  724.                                         that may occur cause the
  725.                                         szErrorDetail, szErrorMessage
  726.                                         and nResultCode fields of this
  727.                                         structure to be loaded with
  728.                                         descriptive information.
  729.  
  730.                          lpRecordBuffer LPSTR Points to a buffer
  731.                                         provided by the caller to
  732.                                         receive the formatted record.
  733.                                         This buffer must be at least as
  734.                                         large as the nRecordSize field
  735.                                         of SQLTABLE structure indicates.
  736.  
  737.           Return Value   The return value is 1 if no errors occurred and
  738.                          the table had at least one record, otherwise it
  739.                          is 0.
  740.  
  741.  
  742.  
  743.  
  744.  
  745.                                                 Functions: SqlFetchFirst
  746.           Orion SQL API                                    Page 13 of 51
  747.  
  748.  
  749.           Comments       The usual procedure for using the SqlFetchFirst
  750.                          function is as follows:
  751.  
  752.                          1)   Set Data Format in the wFlags field of the
  753.                               lpSqlControl parameter to the option you
  754.                               intend to use.  If you have selected the
  755.                               mSqlFlagFormatPadded option, set the
  756.                               nPadding field of the lpSqlControl
  757.                               parameter to the number of spaces you want
  758.                               between fields.
  759.  
  760.                          2)   Call SqlExecute.
  761.  
  762.                          3)   Call SqlDescribeTable to determine the
  763.                               characteristics of the result table.  Of
  764.                               particular interest are the nRecordSize
  765.                               and lNumberOfRecords fields of the
  766.                               resultant SQLTABLE structure.
  767.  
  768.                          4)   If SqlTable.lNumberOfRecords indicates
  769.                               that one or more result table records are
  770.                               available, allocate a buffer sufficiently
  771.                               large (at least as large as
  772.                               SqlTable.nRecordSize) to receive the
  773.                               record's data.  Set the lpRecordBuffer
  774.                               parameter to point to this buffer and set
  775.                               the nRecordBufferSize field of the
  776.                               lpSqlControl parameter to the size of the
  777.                               buffer.
  778.  
  779.                          5)   Call SqlFetchFirst.
  780.  
  781.                          Once these steps are completed, you can make
  782.                          unlimited calls to any of the Orion SQL API
  783.                          fetch functions without repeating steps (1)
  784.                          through (4).  The same lpRecordBuffer can be
  785.                          reused for all fetches.  Note, however, should
  786.                          you change the Data Format setting in the
  787.                          wFlags field of the lpSqlControl parameter, you
  788.                          must call SqlDescribeTable to calculate the new
  789.                          nRecordSize setting, reallocate the
  790.                          lpRecordBuffer and adjust the nRecordBufferSize
  791.                          field of the lpSqlControl parameter
  792.                          accordingly.
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.                                                 Functions: SqlFetchFirst
  808.           Orion SQL API                                    Page 14 of 51
  809.  
  810.  
  811.                              Functions: SqlFetchLast
  812.  
  813.  
  814.           Syntax         BOOL FAR PASCAL SqlFetchLast(hUser, hCursor,
  815.                               lpSqlControl, lpRecordBuffer)
  816.  
  817.                          This function reads the last record in the
  818.                          result table associated with the hCursor
  819.                          parameter.  The data in this record is
  820.                          formatted and loaded into the buffer provided
  821.                          by the caller and pointed to by the
  822.                          lpRecordBuffer parameter.  To fetch this record
  823.                          you must have already logged in (SqlLogin),
  824.                          created a cursor (SqlCursorOpen) and executed a
  825.                          query (SqlExecute) which contained an SQL
  826.                          SELECT statement.
  827.  
  828.                          Parameter Type/Description
  829.  
  830.                          hUser          HANDLE Identifies the user who
  831.                                         owns the cursor.  The hUser
  832.                                         parameter must have been created
  833.                                         with the SqlLogin function.
  834.  
  835.                          hCursor        HANDLE Identifies the cursor
  836.                                         which owns the result table in
  837.                                         which the record exists.  The
  838.                                         hCursor parameter must have been
  839.                                         created with the SqlCursorOpen
  840.                                         function.  A result table must
  841.                                         be associated with the cursor.
  842.                                         A result table is created when a
  843.                                         query containing an SQL SELECT
  844.                                         statement is passed to
  845.                                         SqlExecute.
  846.  
  847.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  848.                                         Control Structure.  Any errors
  849.                                         that may occur cause the
  850.                                         szErrorDetail, szErrorMessage
  851.                                         and nResultCode fields of this
  852.                                         structure to be loaded with
  853.                                         descriptive information.
  854.  
  855.                          lpRecordBuffer LPSTR Points to a buffer
  856.                                         provided by the caller to
  857.                                         receive the formatted record.
  858.                                         This buffer must be at least as
  859.                                         large as the nRecordSize field
  860.                                         of SQLTABLE structure indicates.
  861.  
  862.           Return Value   The return value is 1 if no errors occurred and
  863.                          the table had at least one record, otherwise it
  864.                          is 0.
  865.  
  866.  
  867.  
  868.  
  869.                                                  Functions: SqlFetchLast
  870.           Orion SQL API                                    Page 15 of 51
  871.  
  872.  
  873.           Comments       The usual procedure for using the SqlFetchLast
  874.                          function is as follows:
  875.  
  876.                          1)   Set Data Format in the wFlags field of the
  877.                               lpSqlControl parameter to the option you
  878.                               intend to use.  If you have selected the
  879.                               mSqlFlagFormatPadded option, set the
  880.                               nPadding field of the lpSqlControl
  881.                               parameter to the number of spaces you want
  882.                               between fields.
  883.  
  884.                          2)   Call SqlExecute.
  885.  
  886.                          3)   Call SqlDescribeTable to determine the
  887.                               characteristics of the result table.  Of
  888.                               particular interest are the nRecordSize
  889.                               and lNumberOfRecords fields of the
  890.                               resultant SQLTABLE structure.
  891.  
  892.                          4)   If SqlTable.lNumberOfRecords indicates
  893.                               that one or more result table records are
  894.                               available, allocate a buffer sufficiently
  895.                               large (at least as large as
  896.                               SqlTable.nRecordSize) to receive the
  897.                               record's data.  Set the lpRecordBuffer
  898.                               parameter to point to this buffer and set
  899.                               the nRecordBufferSize field of the
  900.                               lpSqlControl parameter to the size of the
  901.                               buffer.
  902.  
  903.                          5)   Call SqlFetchLast.
  904.  
  905.                          Once these steps are completed, you can make
  906.                          unlimited calls to any of the Orion SQL API
  907.                          fetch functions without repeating steps (1)
  908.                          through (4).  The same lpRecordBuffer can be
  909.                          reused for all fetches.  Note, however, should
  910.                          you change the Data Format setting in the
  911.                          wFlags field of the lpSqlControl parameter, you
  912.                          must call SqlDescribeTable to calculate the new
  913.                          nRecordSize setting, reallocate the
  914.                          lpRecordBuffer and adjust the nRecordBufferSize
  915.                          field of the lpSqlControl parameter
  916.                          accordingly.
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.                                                  Functions: SqlFetchLast
  932.           Orion SQL API                                    Page 16 of 51
  933.  
  934.  
  935.                              Functions: SqlFetchNext
  936.  
  937.  
  938.           Syntax         BOOL FAR PASCAL SqlFetchNext(hUser, hCursor,
  939.                               lpSqlControl, lpRecordBuffer)
  940.  
  941.                          This function reads the next record in the
  942.                          result table associated with the hCursor
  943.                          parameter.  The data in this record is
  944.                          formatted and loaded into the buffer provided
  945.                          by the caller and pointed to by the
  946.                          lpRecordBuffer parameter.  To fetch this record
  947.                          you must have already preformed at least one
  948.                          SqlFetchFirst or SqlFetchLast or
  949.                          SqlFetchPositioned function.
  950.  
  951.                          Parameter Type/Description
  952.  
  953.                          hUser          HANDLE Identifies the user who
  954.                                         owns the cursor.  The hUser
  955.                                         parameter must have been created
  956.                                         with the SqlLogin function.
  957.  
  958.                          hCursor        HANDLE Identifies the cursor
  959.                                         which owns the result table in
  960.                                         which the record exists.  The
  961.                                         hCursor parameter must have been
  962.                                         created with the SqlCursorOpen
  963.                                         function.  A result table must
  964.                                         be associated with the cursor.
  965.                                         A result table is created when a
  966.                                         query containing an SQL SELECT
  967.                                         statement is passed to
  968.                                         SqlExecute.
  969.  
  970.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  971.                                         Control Structure.  Any errors
  972.                                         that may occur cause the
  973.                                         szErrorDetail, szErrorMessage
  974.                                         and nResultCode fields of this
  975.                                         structure to be loaded with
  976.                                         descriptive information.
  977.  
  978.                          lpRecordBuffer LPSTR Points to a buffer
  979.                                         provided by the caller to
  980.                                         receive the formatted record.
  981.                                         This buffer must be at least as
  982.                                         large as the nRecordSize field
  983.                                         of SQLTABLE structure indicates.
  984.  
  985.           Return Value   The return value is 1 if no errors occurred and
  986.                          the cursor was not already positioned at the
  987.                          last record, otherwise it is 0.
  988.  
  989.  
  990.  
  991.  
  992.  
  993.                                                  Functions: SqlFetchNext
  994.           Orion SQL API                                    Page 17 of 51
  995.  
  996.  
  997.           Comments       The same lpRecordBuffer can be reused for all
  998.                          fetches. Note, however, should you change the
  999.                          Data Format setting in the wFlags field of the
  1000.                          lpSqlControl parameter, you must call
  1001.                          SqlDescribeTable to calculate the new
  1002.                          nRecordSize setting, reallocate the
  1003.                          lpRecordBuffer and adjust the nRecordBufferSize
  1004.                          field of the lpSqlControl parameter
  1005.                          accordingly.
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.                                                  Functions: SqlFetchNext
  1056.           Orion SQL API                                    Page 18 of 51
  1057.  
  1058.  
  1059.                           Functions: SqlFetchPositioned
  1060.  
  1061.  
  1062.           Syntax         BOOL FAR PASCAL SqlFetchPositioned(hUser,
  1063.                               hCursor, lpSqlControl, lRecordPosition,
  1064.                               lpRecordBuffer)
  1065.  
  1066.                          This function reads a record in the result
  1067.                          table associated with the hCursor parameter.
  1068.                          The lRecordPosition parameter indicates which
  1069.                          record is to be read.  When lRecordPosition is
  1070.                          '1', the first physical record is read; when
  1071.                          lRecordPosition is '2', the second physical
  1072.                          record is read and so on and so forth.  The
  1073.                          data in this record is formatted and loaded
  1074.                          into the buffer provided by the caller and
  1075.                          pointed to by the lpRecordBuffer parameter.  To
  1076.                          fetch this record you must have already logged
  1077.                          in (SqlLogin), created a cursor (SqlCursorOpen)
  1078.                          and executed a query (SqlExecute) which
  1079.                          contained an SQL SELECT statement.
  1080.  
  1081.                          Parameter Type/Description
  1082.  
  1083.                          hUser          HANDLE Identifies the user who
  1084.                                         owns the cursor.  The hUser
  1085.                                         parameter must have been created
  1086.                                         with the SqlLogin function.
  1087.  
  1088.                          hCursor        HANDLE Identifies the cursor
  1089.                                         which owns the result table in
  1090.                                         which the record exists.  The
  1091.                                         hCursor parameter must have been
  1092.                                         created with the SqlCursorOpen
  1093.                                         function.  A result table must
  1094.                                         be associated with the cursor.
  1095.                                         A result table is created when a
  1096.                                         query containing an SQL SELECT
  1097.                                         statement is passed to
  1098.                                         SqlExecute.
  1099.  
  1100.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  1101.                                         Control Structure.  Any errors
  1102.                                         that may occur cause the
  1103.                                         szErrorDetail, szErrorMessage
  1104.                                         and nResultCode fields of this
  1105.                                         structure to be loaded with
  1106.                                         descriptive information.
  1107.  
  1108.                          lRecordPosition  unsigned long Indicates which
  1109.                                         record is to be read.
  1110.  
  1111.                          lpRecordBuffer LPSTR Points to a buffer
  1112.                                         provided by the caller to
  1113.  
  1114.  
  1115.  
  1116.  
  1117.                                            Functions: SqlFetchPositioned
  1118.           Orion SQL API                                    Page 19 of 51
  1119.  
  1120.  
  1121.                                         receive the formatted record.
  1122.                                         This buffer must be at least as
  1123.                                         large as the nRecordSize field
  1124.                                         of SQLTABLE structure indicates.
  1125.  
  1126.           Return Value   The return value is 1 if no errors occurred and
  1127.                          lRecordPosition is greater than zero and less
  1128.                          then or equal to the number of records in the
  1129.                          table, otherwise it is 0.
  1130.  
  1131.           Comments       Physical position is the raw position of the
  1132.                          record in the file.  Physical order is not the
  1133.                          same as the order you specify with the SQL
  1134.                          ORDER BY clause.
  1135.  
  1136.                          The usual procedure for using the
  1137.                          SqlFetchPositioned function is as follows:
  1138.  
  1139.                          1)   Set Data Format in the wFlags field of the
  1140.                               lpSqlControl parameter to the option you
  1141.                               intend to use.  If you have selected the
  1142.                               mSqlFlagFormatPadded option, set the
  1143.                               nPadding field of the lpSqlControl
  1144.                               parameter to the number of spaces you want
  1145.                               between fields.
  1146.  
  1147.                          2)   Call SqlExecute.
  1148.  
  1149.                          3)   Call SqlDescribeTable to determine the
  1150.                               characteristics of the result table.  Of
  1151.                               particular interest are the nRecordSize
  1152.                               and lNumberOfRecords fields of the
  1153.                               resultant SQLTABLE structure.
  1154.  
  1155.                          4)   If SqlTable.lNumberOfRecords indicates
  1156.                               that one or more result table records are
  1157.                               available, allocate a buffer sufficiently
  1158.                               large (at least as large as
  1159.                               SqlTable.nRecordSize) to receive the
  1160.                               record's data.  Set the lpRecordBuffer
  1161.                               parameter to point to this buffer and set
  1162.                               the nRecordBufferSize field of the
  1163.                               lpSqlControl parameter to the size of the
  1164.                               buffer.
  1165.  
  1166.                          5)   Call SqlFetchPositioned.
  1167.  
  1168.                          Once these steps are completed, you can make
  1169.                          unlimited calls to any of the Orion SQL API
  1170.                          fetch functions without repeating steps (1)
  1171.                          through (4).  The same lpRecordBuffer can be
  1172.                          reused for all fetches.  Note, however, should
  1173.                          you change the Data Format setting in the
  1174.                          wFlags field of the lpSqlControl parameter, you
  1175.  
  1176.  
  1177.  
  1178.  
  1179.                                            Functions: SqlFetchPositioned
  1180.           Orion SQL API                                    Page 20 of 51
  1181.  
  1182.  
  1183.                          must call SqlDescribeTable to calculate the new
  1184.                          nRecordSize setting, reallocate the
  1185.                          lpRecordBuffer and adjust the nRecordBufferSize
  1186.                          field of the lpSqlControl parameter
  1187.                          accordingly.
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.                                            Functions: SqlFetchPositioned
  1242.           Orion SQL API                                    Page 21 of 51
  1243.  
  1244.  
  1245.                            Functions: SqlFetchPrevious
  1246.  
  1247.  
  1248.           Syntax         BOOL FAR PASCAL SqlFetchPrevious(hUser,
  1249.                               hCursor, lpSqlControl, lpRecordBuffer)
  1250.  
  1251.                          This function reads the previous record in the
  1252.                          result table associated with the hCursor
  1253.                          parameter.  The data in this record is
  1254.                          formatted and loaded into the buffer provided
  1255.                          by the caller and pointed to by the
  1256.                          lpRecordBuffer parameter.  To fetch this record
  1257.                          you must have already preformed at least one
  1258.                          SqlFetchFirst or SqlFetchLast or
  1259.                          SqlFetchPositioned function.
  1260.  
  1261.                          Parameter Type/Description
  1262.  
  1263.                          hUser          HANDLE Identifies the user who
  1264.                                         owns the cursor.  The hUser
  1265.                                         parameter must have been created
  1266.                                         with the SqlLogin function.
  1267.  
  1268.                          hCursor        HANDLE Identifies the cursor
  1269.                                         which owns the result table in
  1270.                                         which the record exists.  The
  1271.                                         hCursor parameter must have been
  1272.                                         created with the SqlCursorOpen
  1273.                                         function.  A result table must
  1274.                                         be associated with the cursor.
  1275.                                         A result table is created when a
  1276.                                         query containing an SQL SELECT
  1277.                                         statement is passed to
  1278.                                         SqlExecute.
  1279.  
  1280.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  1281.                                         Control Structure.  Any errors
  1282.                                         that may occur cause the
  1283.                                         szErrorDetail, szErrorMessage
  1284.                                         and nResultCode fields of this
  1285.                                         structure to be loaded with
  1286.                                         descriptive information.
  1287.  
  1288.                          lpRecordBuffer LPSTR Points to a buffer
  1289.                                         provided by the caller to
  1290.                                         receive the formatted record.
  1291.                                         This buffer must be at least as
  1292.                                         large as the nRecordSize field
  1293.                                         of SQLTABLE structure indicates.
  1294.  
  1295.           Return Value   The return value is 1 if no errors occurred and
  1296.                          the cursor was not already positioned at the
  1297.                          first record, otherwise it is 0.
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.                                              Functions: SqlFetchPrevious
  1304.           Orion SQL API                                    Page 22 of 51
  1305.  
  1306.  
  1307.           Comments       The same lpRecordBuffer can be reused for all
  1308.                          fetches. Note, however, should you change the
  1309.                          Data Format setting in the wFlags field of the
  1310.                          lpSqlControl parameter, you must call
  1311.                          SqlDescribeTable to calculate the new
  1312.                          nRecordSize setting, reallocate the
  1313.                          lpRecordBuffer and adjust the nRecordBufferSize
  1314.                          field of the lpSqlControl parameter
  1315.                          accordingly.
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.                                              Functions: SqlFetchPrevious
  1366.           Orion SQL API                                    Page 23 of 51
  1367.  
  1368.  
  1369.                              Functions: SqlGetStatus
  1370.  
  1371.  
  1372.           Syntax         BOOL FAR PASCAL SqlGetStatus(hUser, hCursor,
  1373.                               lpSqlControl, lpSqlStatus)
  1374.  
  1375.                          This function returns status information about
  1376.                          the most recent call to SqlExecute which used
  1377.                          the cursor indicated by the hCursor parameter.
  1378.                          Status information includes the number of
  1379.                          database records deleted, inserted, selected or
  1380.                          updated and the amount of time elapsed during
  1381.                          query execution.
  1382.  
  1383.                          If the hUser and hCursor parameters are set to
  1384.                          0, SqlGetStatus simply tests for the presence
  1385.                          of an active running Orion Database
  1386.                          Administrator.  A value of 1 is returned if and
  1387.                          only if the database administrator is running.
  1388.  
  1389.                          Parameter Type/Description
  1390.  
  1391.                          hUser          HANDLE Identifies the user who
  1392.                                         owns the cursor.  The hUser
  1393.                                         parameter must have been created
  1394.                                         with the SqlLogin function.
  1395.  
  1396.                          hCursor        HANDLE Identifies the cursor for
  1397.                                         which the status is to be
  1398.                                         obtained.  The hCursor parameter
  1399.                                         must have been created with the
  1400.                                         SqlCursorOpen function.
  1401.  
  1402.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  1403.                                         Control Structure.  Any errors
  1404.                                         that may occur cause the
  1405.                                         szErrorDetail, szErrorMessage
  1406.                                         and nResultCode fields of this
  1407.                                         structure to be loaded with
  1408.                                         descriptive information.
  1409.  
  1410.                          lpSqlStatus    LPSQLSTATUS Points to the target
  1411.                                         SQL Status Structure.
  1412.  
  1413.           Return Value   The return value is 1 if no errors occurred,
  1414.                          otherwise it is 0.
  1415.  
  1416.           Comments       Each cursor's status information is reset every
  1417.                          time SqlExecute is called.
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.                                                  Functions: SqlGetStatus
  1428.           Orion SQL API                                    Page 24 of 51
  1429.  
  1430.  
  1431.                                Functions: SqlLogin
  1432.  
  1433.  
  1434.           Syntax         HANDLE FAR PASCAL SqlLogin(lpSqlControl,
  1435.                               lpstrUserName, lpstrUserPassword)
  1436.  
  1437.                          In order to access the SQL Database
  1438.                          Administrator you must first identify yourself
  1439.                          as an user with sufficient privilege to access
  1440.                          the database.  This is accomplished by calling
  1441.                          the SqlLogin function with your user name and
  1442.                          password.  Once logged in, you can reference
  1443.                          all your tables without specifying an user
  1444.                          name. To reference another user's table you
  1445.                          must prefix the table name with the other
  1446.                          user's user name.  For example for user
  1447.                          "JohnDoe" to select all columns of the system
  1448.                          tables he must use:
  1449.  
  1450.                               SELECT * FROM SYSTEM.TABLES;
  1451.  
  1452.                          For user "SYSTEM" to select the "PartNumber"
  1453.                          column of user "JohnDoe"'s table "Inventory"
  1454.                          use the form:
  1455.  
  1456.                               SELECT JohnDoe.Inventory.PartNumber FROM
  1457.                                    JohnDoe.Inventory;
  1458.  
  1459.                          Or, more simply:
  1460.  
  1461.                               SELECT PartNumber FROM JohnDoe.Inventory;
  1462.  
  1463.                          Parameter Type/Description
  1464.  
  1465.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  1466.                                         Control Structure.  Any errors
  1467.                                         that may occur cause the
  1468.                                         szErrorDetail, szErrorMessage
  1469.                                         and nResultCode fields of this
  1470.                                         structure to be loaded with
  1471.                                         descriptive information.
  1472.  
  1473.                          lpstrUserName  LPSTR Points to a null
  1474.                                         terminated string containing the
  1475.                                         user name.
  1476.  
  1477.                          lpstrUserPassword        LPSTR Points to a null
  1478.                                         terminated string containing the
  1479.                                         user password.
  1480.  
  1481.           Return Value   The return value is an user handle if no errors
  1482.                          occurred while logging in, otherwise it is 0.
  1483.                          You must use this user handle in all calls to
  1484.                          the Orion SQL API.
  1485.  
  1486.  
  1487.  
  1488.  
  1489.                                                      Functions: SqlLogin
  1490.           Orion SQL API                                    Page 25 of 51
  1491.  
  1492.  
  1493.           Comments       Only those users recognized by the Orion
  1494.                          Database Administrator will be allowed to log
  1495.                          in.  When first installed, the Orion Database
  1496.                          Administrator only recognizes the user "SYSTEM"
  1497.                          whose password is "ORION". You can create
  1498.                          additional users by logging in as "SYSTEM" with
  1499.                          password "ORION" and inserting records into the
  1500.                          SYSTEM.USERS table.  This table has three
  1501.                          columns: USER_NAME, USER_PASSWORD and REMARK.
  1502.                          To add user "JohnDoe" with password
  1503.                          "IWantToRegisterNow" execute:
  1504.  
  1505.                               INSERT INTO USERS VALUES ('JohnDoe',
  1506.                                    'IWantToRegisterNow', NULL);
  1507.  
  1508.                          John Doe can now login.
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.                                                      Functions: SqlLogin
  1552.           Orion SQL API                                    Page 26 of 51
  1553.  
  1554.  
  1555.                                Functions: SqlLogout
  1556.  
  1557.  
  1558.           Syntax         BOOL FAR PASCAL SqlLogout(hUser, lpSqlControl)
  1559.  
  1560.                          This function logs the user off the system.  If
  1561.                          the Automatic Commit option flag is set in the
  1562.                          wFlags field of the lpSqlControl parameter, any
  1563.                          transaction still in progress is automatically
  1564.                          committed; otherwise, all work performed by the
  1565.                          user since logging in or since the last COMMIT
  1566.                          WORK query (whichever occurred last) is rolled
  1567.                          back.
  1568.  
  1569.                          Parameter Type/Description
  1570.  
  1571.                          hUser          HANDLE Identifies the user who
  1572.                                         wishes to log off.  The hUser
  1573.                                         parameter must have been created
  1574.                                         with the SqlLogin function.
  1575.  
  1576.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  1577.                                         Control Structure.  Any errors
  1578.                                         that may occur cause the
  1579.                                         szErrorDetail, szErrorMessage
  1580.                                         and nResultCode fields of this
  1581.                                         structure to be loaded with
  1582.                                         descriptive information.
  1583.  
  1584.           Return Value   The return value is 1 if no errors occurred,
  1585.                          otherwise it is 0.
  1586.  
  1587.           Comments       While SqlLogout automatically closes all the
  1588.                          user's cursor before logging the user off, we
  1589.                          recommend explicitly closing cursor when they
  1590.                          are no longer needed.
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.                                                     Functions: SqlLogout
  1614.           Orion SQL API                                    Page 27 of 51
  1615.  
  1616.  
  1617.                                     Constants
  1618.  
  1619.  
  1620.           This section includes a formal description of all constants
  1621.           defined in the Orion SQL API include file for 'C' and the
  1622.           global file for 'Visual Basic'.
  1623.  
  1624.           Be sure to use the values by name as the numeric values may
  1625.           (and probably will) change in the next release of the Orion
  1626.           SQL API.
  1627.  
  1628.           Data Class          Identifies the general characteristics of
  1629.                               a column in the result table
  1630.  
  1631.           Data Type           Identifies the particular characteristics
  1632.                               of a column in the result table
  1633.  
  1634.           Data Format         Instructs the Orion SQL API as to the
  1635.                               format of the returned data in the result
  1636.                               table
  1637.  
  1638.           Automatic Commit    Instructs the Orion SQL API whether to
  1639.                               commit or roll back any pending
  1640.                               transaction at user log out
  1641.  
  1642.           Name Length         Defines the maximum length of user, table
  1643.                               and column names
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.                                                                Constants
  1676.           Orion SQL API                                    Page 28 of 51
  1677.  
  1678.  
  1679.                               Constants: Data Class
  1680.  
  1681.  
  1682.           The following constants identify the general characteristics
  1683.           of a column in the result table.  The nDataClass field of the
  1684.           SQLCOLUMN data structure is set to one of these values as a
  1685.           result of an SqlDescribeColumn function call.
  1686.  
  1687.           mSqlDataClassAPPROXIMATE Indicates that the column is one of
  1688.                                    the approximate numeric data types
  1689.  
  1690.           mSqlDataClassBINARY      Indicates that the column is of the
  1691.                                    binary data type
  1692.  
  1693.           mSqlDataClassCHAR        Indicates that the column is one of
  1694.                                    the character string data types
  1695.  
  1696.           mSqlDataClassEXACT       Indicates that the column is one of
  1697.                                    the exact numeric data types
  1698.  
  1699.           mSqlDataClassINVALID     Indicates that the data type of the
  1700.                                    column is invalid
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.                                                    Constants: Data Class
  1738.           Orion SQL API                                    Page 29 of 51
  1739.  
  1740.  
  1741.                                Constants: Data Type
  1742.  
  1743.  
  1744.           The following constants identify the particular
  1745.           characteristics of a column in the result table.  The
  1746.           nDataType field of the SQLCOLUMN data structure is set to one
  1747.           of these values as a result of an SqlDescribeColumn function
  1748.           call.
  1749.  
  1750.           mSqlDataTypeBINARY       Indicates that the data type of the
  1751.                                    column is BINARY: its length is given
  1752.                                    by the nPrecision field of the
  1753.                                    SQLCOLUMN data structure
  1754.  
  1755.           mSqlDataTypeCHAR         Indicates that the data type of the
  1756.                                    column is CHAR: its length is given
  1757.                                    by the nPrecision field of the
  1758.                                    SQLCOLUMN data structure
  1759.  
  1760.           mSqlDataTypeDECIMAL      Indicates that the data type of the
  1761.                                    column is DECIMAL: its precision and
  1762.                                    scale are given by the nPrecision and
  1763.                                    nScale fields of the SQLCOLUMN data
  1764.                                    structure
  1765.  
  1766.           mSqlDataTypeDOUBLE       Indicates that the data type of the
  1767.                                    column is DOUBLE PRECISION: its
  1768.                                    precision is given by the nPrecision
  1769.                                    field of the SQLCOLUMN data structure
  1770.  
  1771.           mSqlDataTypeFLOAT        Indicates that the data type of the
  1772.                                    column is FLOAT: its precision is
  1773.                                    given by the nPrecision field of the
  1774.                                    SQLCOLUMN data structure
  1775.  
  1776.           mSqlDataTypeINTEGER      Indicates that the data type of the
  1777.                                    column is INTEGER: its precision is
  1778.                                    given by the nPrecision field of the
  1779.                                    SQLCOLUMN data structure
  1780.  
  1781.           mSqlDataTypeNUMERIC      Indicates that the data type of the
  1782.                                    column is NUMERIC: its precision and
  1783.                                    scale are given by the nPrecision and
  1784.                                    nScale fields of the SQLCOLUMN data
  1785.                                    structure
  1786.  
  1787.           mSqlDataTypeREAL         Indicates that the data type of the
  1788.                                    column is REAL: its precision is
  1789.                                    given by the nPrecision field of the
  1790.                                    SQLCOLUMN data structure
  1791.  
  1792.           mSqlDataTypeSMALLINT     Indicates that the data type of the
  1793.                                    column is SMALLINT: its precision is
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.                                                     Constants: Data Type
  1800.           Orion SQL API                                    Page 30 of 51
  1801.  
  1802.  
  1803.                                    given by the nPrecision field of the
  1804.                                    SQLCOLUMN data structure
  1805.  
  1806.           mSqlDataTypeVARCHAR      Indicates that the data type of the
  1807.                                    column is VARCHAR: its maximum length
  1808.                                    is given by the nPrecision field of
  1809.                                    the SQLCOLUMN data structure
  1810.  
  1811.           mSqlDataTypeINVALID      Indicates that the data type of the
  1812.                                    column is invalid
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.                                                     Constants: Data Type
  1862.           Orion SQL API                                    Page 31 of 51
  1863.  
  1864.  
  1865.                               Constants: Data Format
  1866.  
  1867.  
  1868.           When a record is fetched from the result table by means of one
  1869.           of the SqlFetch functions, the Orion SQL API loads the record
  1870.           into a buffer provided by the user.  The record is returned in
  1871.           one of three optional formats.  The user selects the format he
  1872.           wants by setting the wFlags field of the SQLCONTROL structure
  1873.           to one (and only one) of the following values:
  1874.  
  1875.           mSqlFlagFormatPadded     The record is returned as a single
  1876.                                    null terminated character string.
  1877.                                    The data for each column is contained
  1878.                                    within this string separated by
  1879.                                    spaces.  The number of spaces is set
  1880.                                    by the user in the nPadding field of
  1881.                                    the SQLCONTROL structure.  The length
  1882.                                    of the string is constant across all
  1883.                                    records and is available to the user
  1884.                                    in the nRecordSize field of the
  1885.                                    SQLTABLE data structure. The length
  1886.                                    of each column's portion of the
  1887.                                    string is available to the user in
  1888.                                    the nFieldWidth field of the
  1889.                                    SQLCOLUMN data structure.
  1890.  
  1891.           mSqlFlagFormatString     The record is returned as a set of
  1892.                                    null terminated character strings,
  1893.                                    one for each column. The first
  1894.                                    column's string is loaded into the
  1895.                                    first bytes of the record buffer. The
  1896.                                    second column's string immediately
  1897.                                    follows the first and so on.  Each
  1898.                                    string contains only the minimum
  1899.                                    number of characters to represent the
  1900.                                    data. That is, the strings are not
  1901.                                    padded.
  1902.  
  1903.           mSqlFlagFormatStructure  The record is returned as a packed
  1904.                                    'C' data structure.  This format is
  1905.                                    not recommended for 'Visual Basic'
  1906.                                    users. Fields appear in the 'C' data
  1907.                                    structure in the same order in which
  1908.                                    they appear in the result table.
  1909.                                    Character types are converted to null
  1910.                                    terminated character strings padded
  1911.                                    with spaces to bring them to the
  1912.                                    length of nFieldWidth as found in the
  1913.                                    SQLCOLUMN data structure.
  1914.                                    Approximate and exact numeric types
  1915.                                    are converted to their 'double'
  1916.                                    representation.  A record containing
  1917.                                    three fields: CHAR (10), INTEGER,
  1918.                                    DECIMAL(7,2) would appear as:
  1919.  
  1920.  
  1921.  
  1922.  
  1923.                                                   Constants: Data Format
  1924.           Orion SQL API                                    Page 32 of 51
  1925.  
  1926.  
  1927.                                         struct {
  1928.                                           char    szField1[11];
  1929.                                           double  dField2;
  1930.                                           double  dField3;
  1931.                                         }
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.                                                   Constants: Data Format
  1986.           Orion SQL API                                    Page 33 of 51
  1987.  
  1988.  
  1989.  
  1990.  
  1991.                     Constants: Automatic Commit & Name Length
  1992.  
  1993.  
  1994.           When a query is executed via an SqlExecute call, it is not
  1995.           committed and will be rolled back if the user should happen to
  1996.           log off.
  1997.  
  1998.           mSqlFlagAutoCommitOnLogout Setting this bit of the wFlags
  1999.                                    field of the SQLCONTROL structure
  2000.                                    tells the Orion SQL API to issue a
  2001.                                    commit command to the database
  2002.                                    administrator prior to logging the
  2003.                                    user off.  This flag may be set in
  2004.                                    combination (using the '|' operator)
  2005.                                    with any one of Data Format flags.
  2006.  
  2007.           While character string fields may be quite lengthy: names of
  2008.           users, tables and columns are limited.
  2009.  
  2010.           mSqlMaximumNameLength    This is the maximum length (not
  2011.                                    including the null terminator) of
  2012.                                    names of users, tables and columns.
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.                                Constants: Automatic Commit & Name Length
  2048.           Orion SQL API                                    Page 34 of 51
  2049.  
  2050.  
  2051.                                  Data Structures
  2052.  
  2053.  
  2054.           This section includes a formal description of all data
  2055.           structures which your program will use when it communicates
  2056.           with the Orion SQL API.  Typedefs for all these structures can
  2057.           be found in the Orion SQL API include file for 'C'.
  2058.           Declarations can be found in the global file for 'Visual
  2059.           Basic'.
  2060.  
  2061.           SQLCOLUMN           The data structure which describes a
  2062.                               column in the result table which was
  2063.                               generated by execution of a query
  2064.  
  2065.           SQLCONTROL          The data structure which contains
  2066.                               information needed by the Orion SQL API to
  2067.                               perform its functions and which passes
  2068.                               process information back to the user
  2069.  
  2070.           SQLSTATUS           The data structure with gives the user
  2071.                               access to operational information
  2072.  
  2073.           SQLTABLE            The data structure which describes the
  2074.                               result table which was generated by
  2075.                               execution of a query
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.                                                          Data Structures
  2110.           Orion SQL API                                    Page 35 of 51
  2111.  
  2112.  
  2113.                             Data Structures: SQLCOLUMN
  2114.  
  2115.  
  2116.                       Result Table Column Description Record
  2117.  
  2118.  
  2119.           The SQLCOLUMN data structure describes the characteristics of
  2120.           a specified column of the result table.  The SQLCOLUMN data
  2121.           structure is loaded as a result of an SqlDescribeColumn
  2122.           function call.
  2123.  
  2124.                     typedef struct tagSQLCOLUMN {
  2125.                       BOOL      bRightJustified;
  2126.                       char      szColumnName[mSqlMaximumNameLength+1];
  2127.                       unsigned  nColumnSequenceNumber;
  2128.                       unsigned  nDataClass;
  2129.                       unsigned  nDataType;
  2130.                       unsigned  nFieldWidth;
  2131.                       unsigned  nPrecision;
  2132.                       unsigned  nScale;
  2133.                     } SQLCOLUMN;
  2134.                     typedef SQLCOLUMN *PSQLCOLUMN;
  2135.                     typedef SQLCOLUMN far *LPSQLCOLUMN;
  2136.  
  2137.           The SQLCOLUMN data structure has the following fields:
  2138.  
  2139.           bRightJustified          Indicates whether the column, by
  2140.                                    default, is left or right justified.
  2141.                                    Right justification is indicated by a
  2142.                                    a non-zero value.
  2143.  
  2144.           szColumnName             Gives the column heading as a null
  2145.                                    terminated text string.
  2146.  
  2147.           nColumnSequenceNumber    Column numbers range from 1 to the
  2148.                                    number of columns in the result
  2149.                                    table.
  2150.  
  2151.           nDataClass               Identifies the general
  2152.                                    characteristics of a column in the
  2153.                                    result table.  Its value will be set
  2154.                                    to one of the Data Class constants.
  2155.  
  2156.           nDataType                Identifies the particular
  2157.                                    characteristics of a column in the
  2158.                                    result table.  Its value will be set
  2159.                                    to one of the Data Type constants.
  2160.  
  2161.           nFieldWidth              The number of character positions
  2162.                                    guaranteed to hold the value of this
  2163.                                    column when the record is fetched.
  2164.                                    If Data Format in the wFlags field of
  2165.                                    the lpSqlControl is
  2166.                                    mSqlFlagFormatPadded: nFieldWidth is
  2167.  
  2168.  
  2169.  
  2170.  
  2171.                                               Data Structures: SQLCOLUMN
  2172.           Orion SQL API                                    Page 36 of 51
  2173.  
  2174.  
  2175.                                    set to the size of the column.  If
  2176.                                    Data Format is mSqlFlagFormatString:
  2177.                                    nFieldWidth is set to the size of the
  2178.                                    column plus one for the terminating
  2179.                                    null. If Data Format is
  2180.                                    mSqlFlagFormatStructure and the
  2181.                                    column is numeric: nFieldWidth is set
  2182.                                    to sizeof(double), if the column is a
  2183.                                    character string type: nFieldWidth is
  2184.                                    set to the size of the column plus
  2185.                                    one for the terminating null.
  2186.  
  2187.           nPrecision               If a numeric column, nPrecision is
  2188.                                    set to the precision (as defined by
  2189.                                    ANSI SQL) of the result.  If a
  2190.                                    character field, nPrecision is set to
  2191.                                    the length (as defined by ANSI SQL)
  2192.                                    of the result.
  2193.  
  2194.           nScale                   If a numeric column, nScale is set to
  2195.                                    the scale (as defined by ANSI SQL) of
  2196.                                    the result.  If a character field,
  2197.                                    nScale is 0.
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.                                               Data Structures: SQLCOLUMN
  2234.           Orion SQL API                                    Page 37 of 51
  2235.  
  2236.  
  2237.                            Data Structures: SQLCONTROL
  2238.  
  2239.  
  2240.                     Orion SQL API Interface Control Structure
  2241.  
  2242.  
  2243.           The SQLCONTROL data structure contains the specifications
  2244.           necessary to provide an interface between the applications
  2245.           programmer and the Orion SQL API.
  2246.  
  2247.                     typedef struct tagSQLCONTROL {
  2248.                       char      szErrorDetail[65];
  2249.                       char      szErrorMessage[257];
  2250.                       unsigned  nHiLiteLength;
  2251.                       unsigned  nHiLiteOffset;
  2252.                       unsigned  nPadding;
  2253.                       unsigned  nRecordBufferSize;
  2254.                       unsigned  nResultCode;
  2255.                       unsigned long lRecordPosition;
  2256.                       unsigned long lReserved0
  2257.                       unsigned long lReserved1
  2258.                       unsigned long lReserved2
  2259.                       unsigned long lReserved3
  2260.                       unsigned long lReserved4
  2261.                       WORD      wFlags;
  2262.                     } SQLCONTROL;
  2263.                     typedef SQLCONTROL *PSQLCONTROL;
  2264.                     typedef SQLCONTROL far *LPSQLCONTROL;
  2265.  
  2266.           The SQLCONTROL data structure has the following fields:
  2267.  
  2268.           szErrorDetail            Each time an Orion SQL API function
  2269.                                    is called, any errors that may occur
  2270.                                    cause this field to be loaded with a
  2271.                                    descriptive string: "Error detected
  2272.                                    at line n of module.c".  This
  2273.                                    information is useful if you need to
  2274.                                    call customer service.
  2275.  
  2276.           szErrorMessage           Each time an Orion SQL API function
  2277.                                    is called, any errors that may occur
  2278.                                    cause this field to be loaded with a
  2279.                                    descriptive string: "ERROR xxx:
  2280.                                    text." This provides a useful
  2281.                                    diagnostic while you are debugging
  2282.                                    your application. "xxx" is the ASCII
  2283.                                    representation (base 10) of the
  2284.                                    nResultCode.
  2285.  
  2286.           nHiLiteLength            Each time the SqlExecute is called,
  2287.                                    any syntax errors within the query
  2288.                                    cause this field to be set to the
  2289.                                    length of the offending phrase within
  2290.                                    the query text.
  2291.  
  2292.  
  2293.  
  2294.  
  2295.                                              Data Structures: SQLCONTROL
  2296.           Orion SQL API                                    Page 38 of 51
  2297.  
  2298.  
  2299.           nHiLiteOffset            Each time the SqlExecute is called,
  2300.                                    any syntax errors within the query
  2301.                                    cause this field to be set to the
  2302.                                    offset of the offending phrase within
  2303.                                    the query text.
  2304.  
  2305.           nPadding                 The caller of the Orion SQL API sets
  2306.                                    this field to the number of padding
  2307.                                    spaces to be inserted between columns
  2308.                                    when the wFlags field of the
  2309.                                    SQLCONTROL structure is set to
  2310.                                    mSqlFlagFormatPadded.
  2311.  
  2312.           nRecordBufferSize        The caller of the Orion SQL API sets
  2313.                                    this field to the size (in bytes) of
  2314.                                    the record buffer.  This buffer must
  2315.                                    be at least as large as the value in
  2316.                                    the nRecordSize field of the SQLTABLE
  2317.                                    data structure.  The SQLTABLE data
  2318.                                    structure is available by calling
  2319.                                    SqlDescribeTable.
  2320.  
  2321.           nResultCode              Indicates the basic status condition
  2322.                                    after any call to an Orion SQL API
  2323.                                    function.  A value of 0 indicates no
  2324.                                    error.  Other values are listed under
  2325.                                    Result Codes
  2326.  
  2327.           lRecordPosition          Indicates the position within the
  2328.                                    result table of the most recent
  2329.                                    record fetched. lRecordPosition can
  2330.                                    range from 1 to the number of records
  2331.                                    in the result table. If
  2332.                                    lRecordPosition is 0 then no records
  2333.                                    have been fetched.
  2334.  
  2335.           lReserved0               Do not tamper with this field.
  2336.  
  2337.           lReserved1               Do not tamper with this field.
  2338.  
  2339.           lReserved2               Do not tamper with this field.
  2340.  
  2341.           lReserved3               Do not tamper with this field.
  2342.  
  2343.           lReserved4               Do not tamper with this field.
  2344.  
  2345.           wFlags                   The caller of the Orion SQL API sets
  2346.                                    this field to the desired Data Format
  2347.                                    to be utilized during record fetch
  2348.                                    functions.  The data format may be
  2349.                                    optionally combined using the '|'
  2350.                                    operator with the Automatic Commit
  2351.                                    flag.
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.                                              Data Structures: SQLCONTROL
  2358.           Orion SQL API                                    Page 39 of 51
  2359.  
  2360.  
  2361.                             Data Structures: SQLSTATUS
  2362.  
  2363.  
  2364.                               Query Status Structure
  2365.  
  2366.  
  2367.           The SQLSTATUS data structure describes the overall outcome of
  2368.           the most recent SqlExecute operation for a given cursor.
  2369.  
  2370.                     typedef struct tagSQLSTATUS {
  2371.                     unsigned long lNumberOfRecordDeletes;
  2372.                     unsigned long lNumberOfRecordInserts;
  2373.                     unsigned long lNumberOfRecordSelects;
  2374.                     unsigned long lNumberOfRecordUpdates;
  2375.                     unsigned long lTimeElapsed;
  2376.                     } SQLSTATUS;
  2377.                     typedef SQLSTATUS *PSQLSTATUS;
  2378.                     typedef SQLSTATUS far *LPSQLSTATUS;
  2379.  
  2380.           The SQLSTATUS data structure has the following fields:
  2381.  
  2382.           lNumberOfRecordDeletes   Indicates the total number of records
  2383.                                    deleted by the most recent
  2384.                                    SqlExecute.
  2385.  
  2386.           lNumberOfRecordInserts   Indicates the total number of records
  2387.                                    inserted by the most recent
  2388.                                    SqlExecute.
  2389.  
  2390.           lNumberOfRecordSelects   Indicates the total number of records
  2391.                                    selected by the most recent
  2392.                                    SqlExecute.
  2393.  
  2394.           lNumberOfRecordUpdates   Indicates the total number of records
  2395.                                    updated by the most recent
  2396.                                    SqlExecute.
  2397.  
  2398.           lTimeElapsed             Indicates the time elapsed (in
  2399.                                    milliseconds) during the most recent
  2400.                                    SqlExecute.
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.                                               Data Structures: SQLSTATUS
  2420.           Orion SQL API                                    Page 40 of 51
  2421.  
  2422.  
  2423.                             Data Structures: SQLTABLE
  2424.  
  2425.  
  2426.                          Result Table Description Record
  2427.  
  2428.  
  2429.           The SQLTABLE data structure describes the characteristics of
  2430.           the result table. The SQLTABLE data structure is loaded as a
  2431.           result of an SqlDescribeTable function call.
  2432.  
  2433.                     typedef struct tagSQLTABLE {
  2434.                     unsigned    nNumberOfColumns;
  2435.                     unsigned    nRecordSize;
  2436.                     unsigned long lNumberOfRecords;
  2437.                     } SQLTABLE;
  2438.                     typedef SQLTABLE *PSQLTABLE;
  2439.                     typedef SQLTABLE far *LPSQLTABLE;
  2440.  
  2441.           The SQLTABLE data structure has the following fields:
  2442.  
  2443.           nNumberOfColumns         Indicates the number of columns in
  2444.                                    the result table.
  2445.  
  2446.           nRecordSize              Indicates the minimum size (in bytes)
  2447.                                    of a buffer large enough to hold a
  2448.                                    record fetched from the result table.
  2449.  
  2450.           lNumberOfRecords         Indicates the number of records in
  2451.                                    the result table.
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.                                                Data Structures: SQLTABLE
  2482.           Orion SQL API                                    Page 41 of 51
  2483.  
  2484.  
  2485.                                    Result Codes
  2486.  
  2487.  
  2488.           This section gives an explanation of all result codes returned
  2489.           by the Orion SQL API.  Macro definitions for all result codes
  2490.           can be found in the Orion SQL API include file for 'C'.
  2491.           Global Const definitions can be found in the global file for
  2492.           'Visual Basic'.
  2493.  
  2494.           mSqlErrorAmbiguousColumn When a column name can be found in
  2495.                                    more than one of several tables given
  2496.                                    in the "FROM" clause of a query, the
  2497.                                    database administrator cannot
  2498.                                    determine which of them you mean.  To
  2499.                                    remove the ambiguity, use the
  2500.                                    "Tablename.ColumnName" or the
  2501.                                    "UserName.Tablename.ColumnName"
  2502.                                    syntax.
  2503.  
  2504.           mSqlErrorBadEnvironment  The DatabasePath entry in the
  2505.                                    "win.ini" file is not properly
  2506.                                    specified: it must begin with a drive
  2507.                                    identifier followed by a ':' and a
  2508.                                    '\'.  A typical entry is
  2509.                                    "c:\database".
  2510.  
  2511.           mSqlErrorBinaryNotAllowed When creating a table, the data type
  2512.                                    BINARY was specified, the BINARY data
  2513.                                    type is not allowed in this release.
  2514.  
  2515.           mSqlErrorCannotActivateFile An attempt has been made to access
  2516.                                    a file which is unrecognized by the
  2517.                                    b-tree file manager.  This is an
  2518.                                    internal error which should never
  2519.                                    occur. Please contact customer
  2520.                                    service.
  2521.  
  2522.           mSqlErrorCannotCloseFile When the b-tree file manager
  2523.                                    attempted to close either a data file
  2524.                                    or an index file, _lclose() returned
  2525.                                    an error.  This usually indicates a
  2526.                                    problem with the DOS directory
  2527.                                    structure, we recommend you run
  2528.                                    'chkdsk'.
  2529.  
  2530.           mSqlErrorCannotCloseLog When the database manager attempted to
  2531.                                    close either the 'or_log.dat' or the
  2532.                                    'or_log.idx' transaction journal
  2533.                                    file, _lclose() returned an error.
  2534.                                    This usually indicates a problem with
  2535.                                    the DOS directory structure, we
  2536.                                    recommend you run 'chkdsk'.
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.                                                             Result Codes
  2544.           Orion SQL API                                    Page 42 of 51
  2545.  
  2546.  
  2547.           mSqlErrorCannotCreateDataFile When the b-tree file manager
  2548.                                    attempted to create a data file,
  2549.                                    _lcreat() returned an error.  This
  2550.                                    usually indicates your setting for
  2551.                                    'FILES' in the 'config.sys' file
  2552.                                    should be increased.
  2553.  
  2554.           mSqlErrorCannotCreateDumpFile When the dump manager attempted
  2555.                                    to create a dump file, _lcreat()
  2556.                                    returned an error.  This usually
  2557.                                    indicates your setting for 'FILES' in
  2558.                                    the 'config.sys' file should be
  2559.                                    increased.
  2560.  
  2561.           mSqlErrorCannotCreateFile This result code will not occur.
  2562.  
  2563.           mSqlErrorCannotCreateKeyFile When the b-tree file manager
  2564.                                    attempted to create a key file,
  2565.                                    _lcreat() returned an error.  This
  2566.                                    usually indicates your setting for
  2567.                                    'FILES' in the 'config.sys' file
  2568.                                    should be increased.
  2569.  
  2570.           mSqlErrorCannotCreateLog When the database manager attempted
  2571.                                    to create either the 'or_log.dat' or
  2572.                                    the 'or_log.idx' transaction journal
  2573.                                    file, _lcreat() returned an error.
  2574.                                    This usually indicates your setting
  2575.                                    for 'FILES' in the 'config.sys' file
  2576.                                    should be increased.
  2577.  
  2578.           mSqlErrorCannotDeleteFile When the b-tree file manager
  2579.                                    attempted to remove either a data
  2580.                                    file or a key file, remove() returned
  2581.                                    an error.  This usually indicates
  2582.                                    someone has modified the file's
  2583.                                    attribute settings.  Please be sure
  2584.                                    none of the database files are marked
  2585.                                    as 'read only', 'hidden' or 'system'.
  2586.  
  2587.           mSqlErrorCannotDropTable When the database manager attempted
  2588.                                    to drop a table, its 'use count' was
  2589.                                    greater than zero! This is an
  2590.                                    internal error which should never
  2591.                                    occur.  Please contact customer
  2592.                                    service.
  2593.  
  2594.           mSqlErrorCannotOpenDataFile When the b-tree file manager
  2595.                                    attempted to open a data file,
  2596.                                    _lopen() returned an error.  This
  2597.                                    usually indicates someone has
  2598.                                    modified the file's attribute
  2599.                                    settings or deleted the file.  Please
  2600.                                    be sure none of the database files
  2601.  
  2602.  
  2603.  
  2604.  
  2605.                                                             Result Codes
  2606.           Orion SQL API                                    Page 43 of 51
  2607.  
  2608.  
  2609.                                    are marked as 'read only', 'hidden'
  2610.                                    or 'system'.  Also, delete files only
  2611.                                    via SQL.
  2612.  
  2613.           mSqlErrorCannotOpenFile  This result code will not occur.
  2614.  
  2615.           mSqlErrorCannotOpenKeyFile When the b-tree file manager
  2616.                                    attempted to open a key file,
  2617.                                    _lopen() returned an error.  This
  2618.                                    usually indicates someone has
  2619.                                    modified the file's attribute
  2620.                                    settings or deleted the file.  Please
  2621.                                    be sure none of the database files
  2622.                                    are marked as 'read only', 'hidden'
  2623.                                    or 'system'.  Also, delete files only
  2624.                                    via SQL.
  2625.  
  2626.           mSqlErrorCannotOpenLog   When the database manager attempted
  2627.                                    to open either the 'or_log.dat' or
  2628.                                    the 'or_log.idx' transaction journal
  2629.                                    file, _lopen() returned an error.
  2630.                                    This usually indicates your setting
  2631.                                    for 'FILES' in the 'config.sys' file
  2632.                                    should be increased.
  2633.  
  2634.           mSqlErrorCannotRemoveTable When the database manager attempted
  2635.                                    to delete a file during a 'Toolbox
  2636.                                    Remove' database operation, remove()
  2637.                                    returned an error.  This usually
  2638.                                    indicates someone has modified the
  2639.                                    file's attribute settings.  Please be
  2640.                                    sure none of the database files are
  2641.                                    marked as 'read only', 'hidden' or
  2642.                                    'system'.
  2643.  
  2644.           mSqlErrorCharNotAllowed  When the bind manager attempted to
  2645.                                    initialize an AVG() or SUM() set
  2646.                                    function, it discovered that the
  2647.                                    argument was a CHAR or VARCHAR
  2648.                                    column!
  2649.  
  2650.           mSqlErrorCheckpointDetected This result code will not occur.
  2651.  
  2652.           mSqlErrorDataFileCorrupted The b-tree file manager encountered
  2653.                                    illegal settings in the header
  2654.                                    portions of a data file.  It is
  2655.                                    likely that your DOS files are
  2656.                                    corrupted.
  2657.  
  2658.           mSqlErrorDatabaseCorrupt The database manager encountered
  2659.                                    illegal settings in the header
  2660.                                    portions of the transaction journal
  2661.                                    file.  It is likely that your DOS
  2662.                                    files are corrupted.
  2663.  
  2664.  
  2665.  
  2666.  
  2667.                                                             Result Codes
  2668.           Orion SQL API                                    Page 44 of 51
  2669.  
  2670.  
  2671.           mSqlErrorDbaNotAvailable The Orion SQL API could not establish
  2672.                                    communication with the Orion Database
  2673.                                    Administrator.  Is the database
  2674.                                    administrator running?
  2675.  
  2676.           mSqlErrorDivideByZero    During query execution a divide by
  2677.                                    zero error occurred.
  2678.  
  2679.           mSqlErrorDuplicateColumn During query execution a column is
  2680.                                    called out more than once in a list
  2681.                                    where it can appear only once.  This
  2682.                                    can only occur in the CREATE TABLE
  2683.                                    statement and the INSERT statement.
  2684.  
  2685.           mSqlErrorDuplicateRecord The b-tree file manager detected an
  2686.                                    attempt to violate an UNIQUE
  2687.                                    constraint.
  2688.  
  2689.           mSqlErrorExistingDataFile When the b-tree file manager
  2690.                                    attempted to create a data file, it
  2691.                                    discovered the file already existed!
  2692.                                    Delete files only via SQL.
  2693.  
  2694.           mSqlErrorExistingKeyFile When the b-tree file manager
  2695.                                    attempted to create a key file, it
  2696.                                    discovered the file already existed!
  2697.                                    Delete files only via SQL.
  2698.  
  2699.           mSqlErrorFileReadFailed  When the b-tree file manager
  2700.                                    attempted to read a file, _lread()
  2701.                                    returned an error.
  2702.  
  2703.           mSqlErrorFileSeekFailed  When the b-tree file manager
  2704.                                    attempted to seek a position in a
  2705.                                    file, _llseek() returned an error.
  2706.  
  2707.           mSqlErrorFileWriteFailed When the b-tree file manager
  2708.                                    attempted to write a file, _lwrite()
  2709.                                    returned an error.
  2710.  
  2711.           mSqlErrorGlobalLockFailed When the query manager attempted to
  2712.                                    lock a global resource, GlobalLock()
  2713.                                    or LockResource() returned an error
  2714.                                    condition.
  2715.  
  2716.           mSqlErrorGlobalUnlockFailed When the query manager attempted
  2717.                                    to unlock a global resource,
  2718.                                    GlobalUnlock() or UnlockResource()
  2719.                                    returned an error condition.
  2720.  
  2721.           mSqlErrorImportParseError This result code will not occur.
  2722.  
  2723.           mSqlErrorIncompatibleTypes An attempt was made within the
  2724.                                    query to perform an operation between
  2725.  
  2726.  
  2727.  
  2728.  
  2729.                                                             Result Codes
  2730.           Orion SQL API                                    Page 45 of 51
  2731.  
  2732.  
  2733.                                    two arguments whose types conflict.
  2734.                                    An example is adding a text string to
  2735.                                    a number.
  2736.  
  2737.           mSqlErrorIndexExists     An attempt was made within the query
  2738.                                    to create an index whose name is
  2739.                                    already used.
  2740.  
  2741.           mSqlErrorIndexUndoFailed When the b-tree file manager
  2742.                                    attempted to create an unique key
  2743.                                    value a duplicate was found.  The
  2744.                                    attempt to undo the creation failed.
  2745.                                    This is an internal error which
  2746.                                    should never occur.  Please contact
  2747.                                    customer service.
  2748.  
  2749.           mSqlErrorInitializationFailed When the b-tree file manager
  2750.                                    attempted to initialize its tables, a
  2751.                                    failure was detected.  This is an
  2752.                                    internal error which should never
  2753.                                    occur. Please contact customer
  2754.                                    service.
  2755.  
  2756.           mSqlErrorInsufficientBuffer The record to be returned to the
  2757.                                    Orion SQL API user will not fit in
  2758.                                    the buffer allocated by the user.
  2759.                                    That is, the value of the nRecordSize
  2760.                                    field of the SQLTABLE structure is
  2761.                                    larger than that supplied by the user
  2762.                                    as indicated by the nRecordBufferSize
  2763.                                    field of the SQLCONTROL structure.
  2764.                                    Please be sure to allocate buffers
  2765.                                    large enough to accommodate
  2766.                                    nRecordSize bytes.
  2767.  
  2768.           mSqlErrorInternalError   This is an internal error which
  2769.                                    should never occur.  Please contact
  2770.                                    customer service.
  2771.  
  2772.           mSqlErrorInvalidColumnSpec The arguments of an SQL LIKE
  2773.                                    predicate must be of a character
  2774.                                    string type.
  2775.  
  2776.           mSqlErrorInvalidColumnType This is an internal error which
  2777.                                    should never occur.  Please contact
  2778.                                    customer service.
  2779.  
  2780.           mSqlErrorInvalidCursor   A call was made to the Orion SQL API
  2781.                                    where the pCursor field of the
  2782.                                    SQLCONTROL structure is set to a
  2783.                                    value which does not match any
  2784.                                    existing cursor.
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.                                                             Result Codes
  2792.           Orion SQL API                                    Page 46 of 51
  2793.  
  2794.  
  2795.           mSqlErrorInvalidData     During the execution of a CREATE
  2796.                                    TABLE query, the scale of a numeric
  2797.                                    column exceeds its precision.
  2798.  
  2799.           mSqlErrorInvalidEscapeChar The data type of the escape
  2800.                                    character in a LIKE predicate is not
  2801.                                    a character string type.
  2802.  
  2803.           mSqlErrorInvalidPattern  The pattern of an SQL LIKE predicate
  2804.                                    must not be NULL.
  2805.  
  2806.           mSqlErrorInvalidUser     The SqlLogin function was called with
  2807.                                    an lpstrUserName or lpstrUserPassword
  2808.                                    argument whose length exceeded
  2809.                                    mSqlMaximumNameLength.
  2810.  
  2811.           mSqlErrorKeyFileCorrupted The b-tree file manager encountered
  2812.                                    illegal settings in the header
  2813.                                    portions of a key file.  It is likely
  2814.                                    that your DOS files are corrupted.
  2815.  
  2816.           mSqlErrorListSizesUnequal The number of columns in the column
  2817.                                    list of an SQL INSERT query does not
  2818.                                    match the number of values in the
  2819.                                    value list or the number of fields
  2820.                                    selected in the subquery.
  2821.  
  2822.           mSqlErrorMultipleSelects Only one SELECT statement may occur
  2823.                                    within a query.
  2824.  
  2825.           mSqlErrorNoColumnExists  The bind manager encountered a column
  2826.                                    specification which it could not
  2827.                                    match to a table defined within the
  2828.                                    current scope.
  2829.  
  2830.           mSqlErrorNoIndexExists   A DROP INDEX was attempted when no
  2831.                                    index exists.
  2832.  
  2833.           mSqlErrorNoOldRecord     When the b-tree file manager
  2834.                                    attempted to carry out an
  2835.                                    SqlFetchNext or SqlFetchPrevious
  2836.                                    function, it discovered there was no
  2837.                                    current record.  You must first
  2838.                                    execute an SqlFetchFirst,
  2839.                                    SqlFetchLast or SqlFetchPositioned.
  2840.  
  2841.           mSqlErrorNoTableExists   During execution of a query a table
  2842.                                    name was encountered which cannot be
  2843.                                    found in the database under the
  2844.                                    currently logged-on user name or
  2845.                                    under the explicitly declared user
  2846.                                    name.
  2847.  
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.                                                             Result Codes
  2854.           Orion SQL API                                    Page 47 of 51
  2855.  
  2856.  
  2857.           mSqlErrorNoUserExists    During execution of a query an user
  2858.                                    name was encountered which cannot be
  2859.                                    found in the database.
  2860.  
  2861.           mSqlErrorNodeSizeTooSmall This is an internal error which
  2862.                                    should never occur.  Please contact
  2863.                                    customer service.
  2864.  
  2865.           mSqlErrorNotAggregate    While the select list of a SELECT
  2866.                                    statement started with aggregate
  2867.                                    types (i.e.  SUM()), a select list
  2868.                                    element was later encountered which
  2869.                                    was a simple type (i.e. a column
  2870.                                    specification).  Aggregate types and
  2871.                                    simple types cannot be mixed unless
  2872.                                    the simple type is a grouping column.
  2873.  
  2874.           mSqlErrorNotGroupingColumn A regular column specification was
  2875.                                    encountered where a grouping column
  2876.                                    was required.
  2877.  
  2878.           mSqlErrorNotInGroupedTable While the select list of a SELECT
  2879.                                    statement started with simple types
  2880.                                    (i.e. a column specification), a
  2881.                                    select list element was later
  2882.                                    encountered which was an aggregate
  2883.                                    type (i.e.  SUM()).  Simple types and
  2884.                                    aggregate types cannot be mixed
  2885.                                    unless the simple type is a grouping
  2886.                                    column.
  2887.  
  2888.           mSqlErrorNotSingleRecord A subquery returned more than one
  2889.                                    record.  When a subquery is used as
  2890.                                    an argument to a comparison predicate
  2891.                                    it must return a single record.
  2892.  
  2893.           mSqlErrorNullInNotNullCol An attempt was made to insert a NULL
  2894.                                    value in a column which was declared
  2895.                                    as NOT NULL.
  2896.  
  2897.           mSqlErrorNullNotAllowed  An attempt was made to use a NULL
  2898.                                    value where NULL values are not
  2899.                                    permitted.
  2900.  
  2901.           mSqlErrorParserSyntaxError There is a syntax error in the SQL
  2902.                                    statement.
  2903.  
  2904.           mSqlErrorParserStackOverflow This is an internal error which
  2905.                                    should never occur.  Please contact
  2906.                                    customer service.
  2907.  
  2908.           mSqlErrorPrecisionConflict A mathematical operation was
  2909.                                    requested which would result in loss
  2910.                                    of precision.
  2911.  
  2912.  
  2913.  
  2914.  
  2915.                                                             Result Codes
  2916.           Orion SQL API                                    Page 48 of 51
  2917.  
  2918.  
  2919.           mSqlErrorResultTableExists An attempt was made to commit a
  2920.                                    transaction (COMMIT WORK) while a
  2921.                                    result table was still open.  Users
  2922.                                    must close all cursors which have an
  2923.                                    associated result table before
  2924.                                    committing work.
  2925.  
  2926.           mSqlErrorScaleOverflow   The scale of the result of a
  2927.                                    mathematical operation overflowed.
  2928.  
  2929.           mSqlErrorSecurityViolation SqlLogin was called with an invalid
  2930.                                    lpstrUserName or lpstrUserPassword.
  2931.  
  2932.           mSqlErrorSetFunctionsNested Set functions may not be nested.
  2933.  
  2934.           mSqlErrorStarNotAllowed  The SELECT * syntax is illegal when
  2935.                                    used with the GROUP BY clause.
  2936.  
  2937.           mSqlErrorSubqueryNotOneColumn When a subquery is used as an
  2938.                                    argument to a predicate it must
  2939.                                    return a single field in the select
  2940.                                    list.
  2941.  
  2942.           mSqlErrorTableConflict   The target table of an INSERT, DELETE
  2943.                                    or UPDATE query may not also appear
  2944.                                    in a 'from' clause of a subquery.
  2945.  
  2946.           mSqlErrorTableExists     An attempt was made in a CREATE TABLE
  2947.                                    query to create a table which already
  2948.                                    exists.
  2949.  
  2950.           mSqlErrorTooManyColumnNames The list of column names in an
  2951.                                    INSERT statement exceeds the number
  2952.                                    of columns in the table.
  2953.  
  2954.           mSqlErrorTooManyTablesOpen An attempt was made to open more
  2955.                                    tables than the maximum number of
  2956.                                    tables which may be open at one time.
  2957.  
  2958.           mSqlErrorTrialSizeExceeded The number of events recorded in
  2959.                                    the log has exceeded the trial size
  2960.                                    allotment.  Further operation will
  2961.                                    irrecoverably corrupt your data.
  2962.  
  2963.           mSqlErrorUserNotLoggedIn A call was made to the Orion SQL API
  2964.                                    where hUser does not match an
  2965.                                    existing user.
  2966.  
  2967.           mSqlErrorVariableHeaderMark The b-tree file manager
  2968.                                    encountered illegal settings in the
  2969.                                    header portions of a data file.  It
  2970.                                    is likely that your DOS files are
  2971.                                    corrupted.
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.                                                             Result Codes
  2978.           Orion SQL API                                    Page 49 of 51
  2979.  
  2980.  
  2981.           mSqlErrorVariableHeaderSize The b-tree file manager attempted
  2982.                                    to place a record in a position which
  2983.                                    was not large enough.  This is an
  2984.                                    internal error which should never
  2985.                                    occur. Please contact customer
  2986.                                    service.
  2987.  
  2988.           mSqlErrorVariableHeaderWrong The b-tree file manager
  2989.                                    encountered illegal settings in the
  2990.                                    header portions of a data file.  It
  2991.                                    is likely that your DOS files are
  2992.                                    corrupted.
  2993.  
  2994.           mSqlErrorVariableHeaderZero The b-tree file manager
  2995.                                    encountered illegal settings in the
  2996.                                    header portions of a data file.  It
  2997.                                    is likely that your DOS files are
  2998.                                    corrupted.
  2999.  
  3000.           mSqlErrorWrongVersion    The b-tree file manager has
  3001.                                    determined that your data and key
  3002.                                    files are stamped with a version
  3003.                                    which is incompatible with the
  3004.                                    current release.
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.                                                             Result Codes
  3040.           Orion SQL API                                    Page 50 of 51
  3041.  
  3042.  
  3043.                                      Glossary
  3044.  
  3045.  
  3046.           This section defines specialized terms used in this document.
  3047.  
  3048.           B-tree file manager      The Orion Database Administrator is
  3049.                                    made of several large function units.
  3050.                                    One of these is the b-tree file
  3051.                                    manager.  It is responsible for
  3052.                                    carrying out low level data access
  3053.                                    and operates directly on the raw DOS
  3054.                                    files located in the database
  3055.                                    directory.
  3056.  
  3057.           Bind manager             The Orion Database Administrator is
  3058.                                    made of several large function units.
  3059.                                    One of these is the bind manager.  It
  3060.                                    is responsible for associating the
  3061.                                    logical constructs in the query with
  3062.                                    actual users, tables and columns in
  3063.                                    the database.
  3064.  
  3065.           Cursor                   The Orion SQL API keeps track of the
  3066.                                    result of a query by means of a
  3067.                                    cursor.  The  cursor may include
  3068.                                    status information, the table where
  3069.                                    the result of a SELECT may be found,
  3070.                                    the column descriptions for such a
  3071.                                    table, the current record position
  3072.                                    for fetch operations, etc.
  3073.  
  3074.           Database manager         The Orion Database Administrator is
  3075.                                    made of several large function units.
  3076.                                    One of these is the database manager.
  3077.                                    It is responsible for carrying out
  3078.                                    high level data access and operates
  3079.                                    on logical tables and columns.  The
  3080.                                    database manager uses the b-tree file
  3081.                                    manager to access records in the raw
  3082.                                    DOS files located in the database
  3083.                                    directory.  The database manager is
  3084.                                    also responsible for policing
  3085.                                    transactions and the transaction
  3086.                                    journal (or 'log').
  3087.  
  3088.           Dump manager             The Orion Database Administrator is
  3089.                                    made of several large function units.
  3090.                                    One of these is the dump manager.  It
  3091.                                    is responsible for creating the dump
  3092.                                    file.
  3093.  
  3094.           Physical position        The raw position of the record in the
  3095.                                    file.  Physical order is not the same
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.                                                                 Glossary
  3102.           Orion SQL API                                    Page 51 of 51
  3103.  
  3104.  
  3105.                                    as the order you specify with the SQL
  3106.                                    ORDER BY clause.
  3107.  
  3108.           Query                    By query we mean any SQL statement.
  3109.  
  3110.           Query manager            The Orion Database Administrator is
  3111.                                    made of several large function units.
  3112.                                    One of these is the query manager.
  3113.                                    It is responsible for parsing the
  3114.                                    query into its component parts.
  3115.  
  3116.           Record buffer            One of the arguments to the Orion SQL
  3117.                                    API fetch functions is a pointer to a
  3118.                                    record buffer.  This is the buffer
  3119.                                    which receives the formatted contents
  3120.                                    of a record.
  3121.  
  3122.           Result table             All SELECT queries generate a table
  3123.                                    containing the chosen records.  This
  3124.                                    is called the result table.  Its
  3125.                                    contents are made available to you
  3126.                                    one at a time through one of the
  3127.                                    Orion SQL API fetch functions.
  3128.  
  3129.           Transaction journal      A transaction journal is a pair of
  3130.                                    files ('or_log.dat' and 'or_log.idx')
  3131.                                    written by the database manager.  The
  3132.                                    transaction journal contains a record
  3133.                                    for every event which caused a change
  3134.                                    to the database.
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.                                                                 Glossary